package com.boonya.lab.netty.websocket.config;

import com.boonya.lab.netty.websocket.core.WebSocketServer;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.CompletableFuture;

/**
 * @author Pengjunlin
 * @date 2025/1/14
 */
@Configuration
public class NettyConfig implements CommandLineRunner {

    @Override
    public void run(String... args) throws Exception {
        CompletableFuture.runAsync(()->{
            WebSocketServer webSocketServer = new WebSocketServer(9527, "/websocket");
            try {
                webSocketServer.run();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        });
    }
}
